package com.zzty.txj.dao;

import com.zzty.txj.entity.Clazz;
import com.zzty.txj.entity.Daily;
import com.zzty.txj.entity.DoDaily;
import com.zzty.txj.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;
@Mapper
public interface SearchMapper {
    @Select("select * from clazz")
    public List<Clazz> getClazz();

    @Select("select * from user where clazzId=#{id}")
    public List<User> getUser(int id);

    @Select("select * from doDaily where date=#{date}")
    public List<DoDaily> getDoDaily(String date);

    @Update("update doDaily set finalResult=#{finalResult} where userId=#{userId} and date=#{date} and dailyId=#{dailyId}")
    public Integer count(DoDaily doDaily);

    @Update("update doDaily set finalResult=#{finalResult} where userId=#{userId} and date=#{date} ")
    public Integer count1(DoDaily doDaily);

    @Select("select * from doDaily where userId=#{userId} and date=#{date}")
    public List<DoDaily>counts(DoDaily doDaily);

    @Select("select money from daily where id=#{id}")
    public Integer money(Integer id);

    @Select("select result from doDaily where dailyId=#{dailyId} and userId=#{userId}")
    public Integer result(DoDaily doDaily);

    @Select("select userId from doDaily where userId not in order by newid() and date=#{date}")
    public List<Integer> getUserId(DoDaily doDaily);
}
